package com.whut.controller;

import com.whut.service.ProjectSampleService;
import com.whut.v_request.*;
import com.whut.v_vo.ProjectSampleResponse;
import com.whut.v_vo.ProjectSampleV1Response;
import com.whut.v_vo.ProjectSampleV2Response;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/project/sample")
public class ProjectSampleController {
    private final ProjectSampleService service;

    public ProjectSampleController(ProjectSampleService service) {
        this.service = service;
    }

    @PostMapping("/v1/new")
    public ProjectSampleV1Response v1New(@RequestBody ProjectSampleV1Request request) {
        return service.v1New(request);
    }

    @PostMapping("/v1/step1_confirm")
    public ProjectSampleV1Response v1Step1Confirm(@RequestBody ProjectSampleV1Step1ConfirmRequest request) {
        return service.v1Step1Confirm(request);
    }

    @PostMapping("/v1/step2_confirm")
    public ProjectSampleV1Response v1Step2Confirm(@RequestBody ProjectSampleV1Step2ConfirmRequest request) {
        return service.v1Step2Confirm(request);
    }

    @PostMapping("/v2/new")
    public ProjectSampleV2Response v2New(@RequestBody ProjectSampleV2Request request) {
        return service.v2New2(request);
    }

    @PostMapping("/v2/confirm")
    public ProjectSampleV2Response v2Confirm(@RequestBody ProjectSampleV2ConfirmRequest request) {
        return service.v2Confirm(request);
    }

    @GetMapping("/v1/get/{id}")
    public ProjectSampleV1Response v1Get(@PathVariable Integer id) {
        return service.v1Get(id);
    }

    @GetMapping("/v2/get/{id}")
    public ProjectSampleV2Response v2Get(@PathVariable Integer id) {
        return service.v2Get(id);
    }

    @GetMapping("/get/{id}")
    public ProjectSampleResponse get(@PathVariable Integer id) {
        return service.get(id);
    }

    @PostMapping("available")
    public boolean isAvailable(@RequestBody ProjectSampleItemAvailableRequest request) {
        return service.isAvailable(request);
    }
}
